package day2;

import java.util.Scanner;

import org.junit.Test;

public class IfTest {
	
	//if实例
	@Test
	public void test1() {
		
		System.out.println(3 > 5);//false
		System.out.println(3 <= 5);//true
		
	}
	
	//&&和||的短路运算
	@Test
	public void test2() {
		int num1 = 1;		
		int num2 = 5;
		//&& 短路
		System.out.println(num1 < 0 && num1++ < num2);
		System.out.println(num1);
		System.out.println(num2);
		// || 短路
		System.out.println((num1 > 0) || (num1++ < num2));
		System.out.println(num1);
		System.out.println(num2);
  }
	
	//输入学生成绩判断等级	if判断
	@Test
	public void test3() {
		Scanner scanner = new Scanner(System.in);
		int score = scanner.nextInt();
		
		if ((score >= 90) && (score <= 100)) {
			System.out.println("优秀");
		} else if ((score >= 80) && (score < 90)) {
			System.out.println("良好");			
		} else if ((score >= 70) && (score < 80)) {
			System.out.println("一般");			
		} else if ((score >= 60) && (score < 70)) {
			System.out.println("及格");			
		} else if (score < 60) {
			System.out.println("不及格");			
		}
	}
	
	//输入年份判断年份
	@Test
	public void test4() {
		Scanner scanner = new Scanner(System.in);
		int year = scanner.nextInt();
	
		if (((year % 4 == 0)&&(year % 100 != 0) )|| (year % 400 == 0)) {
			System.out.println("这是闰年");
		}else {
			System.out.println("不是闰年");
		}
	}
	
	
	
}
